home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 13098 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.2 KB  |  42 lines

  1. Path: howland.reston.ans.net!psinntp!psinntp!psinntp!psinntp!usenet
  2. From: grantp@usa.pipeline.com(Pete Grant)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: Mixing C, and C++ modules
  5. Date: 23 Mar 1996 14:21:34 GMT
  6. Organization: Kalevi, Inc.
  7. Message-ID: <4j11de$nvg@news1.h1.usa.pipeline.com>
  8. References: <3153F807.1FBB@access.ch>
  9. NNTP-Posting-Host: 38.8.60.7
  10. X-PipeUser: grantp
  11. X-PipeHub: usa.pipeline.com
  12. X-PipeGCOS: (Pete Grant)
  13. X-Newsreader: Pipeline v3.5.0
  14.  
  15. On Mar 23, 1996 14:09:27 in article <Mixing C, and C++ modules>, 'Jean
  16. Michel den Hartog <mvslasertechnik@access.ch>' wrote: 
  17.  
  18.  
  19. >Can anyone tell me what I must do to call C functions located in C++
  20. modules on  
  21. >a project with both C, and C++ modules ?? 
  22. >With < extern "C" { } > I can call C code from C++, but not Vice versa... 
  23. Yes, you can.  It works both ways.  But note that you can't (reasonably)  
  24. call C++ class member functions (nonstatic) from C code.  If you declare 
  25. an ordinary c++ function with the extern "C" specification, it is  
  26. callable from C.  But note again, that such functions can not be 
  27. overloaded: 
  28.  
  29. #if defined(__cplusplus) 
  30.  extern "C" { 
  31. #endif 
  32. int Foo (int i); 
  33. int Foo (double d); // illegal 
  34.  
  35.  
  36. -- 
  37. Pete Grant 
  38. Kalevi, Inc. 
  39. Software Engineering & development
  40.